const mongoose = require('mongoose')
const { Schema, model } = mongoose

// 文档schema
const answerSchema = new Schema({
    __v: {
        type: Number,
        select: false
    },
    content: {
        type: String,
        required: true
    },
    // 关注者
    answerer: {
        type: Schema.Types.ObjectId,
        ref: 'User',
        required: true,
        select: false
    },
    // 问题id
    questionId: {
        type: String,
        required: true,
    },
    // 投票数
    voteCount: {
        type: Number,
        required: true,
        default: 0,
    },
})

module.exports = model('Answer', answerSchema)